/*     */ package com.qmsk.business.member.memberState.controller;
/*     */ 
/*     */ import com.qmsk.business.member.memberState.dao.MemberStateDAO;
/*     */ import com.utils.gson.in.GsonHeadOneRow;
/*     */ import com.utils.gson.out.GsonEbRst;
/*     */ import com.utils.jdbc.connection.DbConnection;
/*     */ import com.utils.web.RequestUtils;
/*     */ import com.utils.web.ResponseUtils;
/*     */ import java.sql.SQLException;
/*     */ import javax.servlet.http.HttpServletRequest;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ import org.apache.log4j.Logger;
/*     */ import org.springframework.beans.factory.annotation.Autowired;
/*     */ import org.springframework.stereotype.Controller;
/*     */ import org.springframework.transaction.annotation.Transactional;
/*     */ import org.springframework.web.bind.annotation.PathVariable;
/*     */ import org.springframework.web.bind.annotation.RequestMapping;
/*     */ 
/*     */ @Controller
/*     */ @RequestMapping({"/memberState"})
/*     */ public class MemberStateController
/*     */ {
/*  32 */   private static final Logger logger = Logger.getLogger(MemberStateController.class);
/*     */ 
/*     */   @Autowired
/*     */   private MemberStateDAO dao;
/*     */ 
/*     */   @RequestMapping(value={"find/all/{pageIdx}/{pageSize}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getListAll(HttpServletRequest request, HttpServletResponse response, @PathVariable("pageIdx") Integer nPageIdx, @PathVariable("pageSize") Short nPageSize)
/*     */   {
/*  51 */     nPageSize = RequestUtils.getRequestValidPageSize(nPageSize);
/*     */     try {
/*  53 */       GsonEbRst gsonEbRst = this.dao.getGsonOfAll(nPageIdx, nPageSize);
/*  54 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*     */     } catch (SQLException e) {
/*  56 */       logger.error(e);
/*  57 */       ResponseUtils.setErrorMsgResponse(
/*  58 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"find/normal"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getListOfNormal(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/*     */     try
/*     */     {
/*  72 */       GsonEbRst gsonEbRst = this.dao.getGsonOfNormal();
/*  73 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*     */     } catch (Exception e) {
/*  75 */       logger.error(e);
/*  76 */       ResponseUtils.setErrorMsgResponse(
/*  77 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"find/preSale"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getListOfPreSale(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/*     */     try
/*     */     {
/*  91 */       GsonEbRst gsonEbRst = this.dao.getGsonOfPreSale();
/*  92 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*     */     } catch (Exception e) {
/*  94 */       logger.error(e);
/*  95 */       ResponseUtils.setErrorMsgResponse(
/*  96 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"find/reSale"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getListOfReSale(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/*     */     try
/*     */     {
/* 110 */       GsonEbRst gsonEbRst = this.dao.getGsonOfReSale();
/* 111 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*     */     } catch (Exception e) {
/* 113 */       logger.error(e);
/* 114 */       ResponseUtils.setErrorMsgResponse(
/* 115 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"find/lost"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getListOfLost(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/*     */     try
/*     */     {
/* 129 */       GsonEbRst gsonEbRst = this.dao.getGsonOfLost();
/* 130 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*     */     } catch (Exception e) {
/* 132 */       logger.error(e);
/* 133 */       ResponseUtils.setErrorMsgResponse(
/* 134 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"find/bad"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getListOfBad(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/*     */     try
/*     */     {
/* 148 */       GsonEbRst gsonEbRst = this.dao.getGsonOfBad();
/* 149 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*     */     } catch (Exception e) {
/* 151 */       logger.error(e);
/* 152 */       ResponseUtils.setErrorMsgResponse(
/* 153 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"find/upgrade"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getListOfUpgrade(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/*     */     try
/*     */     {
/* 167 */       GsonEbRst gsonEbRst = this.dao.getGsonOfUpgrade();
/* 168 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*     */     } catch (Exception e) {
/* 170 */       logger.error(e);
/* 171 */       ResponseUtils.setErrorMsgResponse(
/* 172 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"find/outoff"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getListOfOutoff(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/*     */     try
/*     */     {
/* 186 */       GsonEbRst gsonEbRst = this.dao.getGsonOfUpgrade();
/* 187 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*     */     } catch (Exception e) {
/* 189 */       logger.error(e);
/* 190 */       ResponseUtils.setErrorMsgResponse(
/* 191 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @Transactional
/*     */   @RequestMapping(value={"insert"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void insert(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 207 */     String sGsonInData = request.getParameter("data");
/*     */     try {
/* 209 */       int nResult = this.dao.insertJsonOneRow(sGsonInData);
/* 210 */       DbConnection.commit();
/* 211 */       ResponseUtils.setSqlResultResponse(nResult, 
/* 212 */         RequestUtils.getSqlInsertDataErrorMessage(request), 
/* 213 */         response);
/*     */     } catch (Exception e) {
/* 215 */       DbConnection.rollback();
/* 216 */       logger.error(e);
/* 217 */       ResponseUtils.setErrorMsgResponse(
/* 218 */         RequestUtils.getSqlInsertDataErrorMessage(request) + ":" + 
/* 219 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @Transactional
/*     */   @RequestMapping(value={"del"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void delete(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 235 */     String id = RequestUtils.getStringOfId(request);
/*     */     try {
/* 237 */       String[] strParams = id.split(",");
/* 238 */       int nResult = this.dao.deleteParams(strParams);
/* 239 */       DbConnection.commit();
/* 240 */       ResponseUtils.setSqlResultResponse(nResult, 
/* 241 */         RequestUtils.getSqlDeleteDataErrorMessage(request), 
/* 242 */         response);
/*     */     } catch (Exception e) {
/* 244 */       DbConnection.rollback();
/* 245 */       logger.error(e);
/* 246 */       ResponseUtils.setErrorMsgResponse(
/* 247 */         RequestUtils.getSqlDeleteDataErrorMessage(request) + ":" + 
/* 248 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @Transactional
/*     */   @RequestMapping(value={"edit"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void update(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 264 */     String id = request.getParameter("id");
/* 265 */     String sGsonInData = request.getParameter("data");
/*     */     try {
/* 267 */       GsonHeadOneRow g = GsonHeadOneRow.jsonStrToObject(sGsonInData);
/* 268 */       if (g == null) {
/* 269 */         ResponseUtils.setErrorMsgResponse(
/* 270 */           RequestUtils.getReadJsonDataErrorMessage(request), 
/* 271 */           response);
/*     */       } else {
/* 273 */         int nResult = this.dao.updateJsonOneRow(g, id);
/* 274 */         ResponseUtils.setSqlResultResponse(nResult, 
/* 275 */           RequestUtils.getSqlUpdateErrorMessage(sGsonInData, request), 
/* 276 */           response);
/*     */       }
/* 278 */       DbConnection.commit();
/*     */     } catch (Exception e) {
/* 280 */       DbConnection.rollback();
/* 281 */       logger.error(e);
/* 282 */       ResponseUtils.setErrorMsgResponse(
/* 283 */         RequestUtils.getSqlUpdateErrorMessage(sGsonInData, request) + ":" + 
/* 284 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\新建文件夹\WEB-INF\classes\
 * Qualified Name:     com.qmsk.business.member.memberState.controller.MemberStateController
 * JD-Core Version:    0.5.3
 */